package com.cunshe.web.manage;

import com.cunshe.common.ResponseVO;
import com.cunshe.config.annotation.Login;
import com.cunshe.domain.CorporateStyle;
import com.cunshe.service.CorporateStyleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 企业风采/头衔
 */
@Api(tags = "企业风采/头衔")
@Login
@RestController
@RequestMapping("/manage/corporateStyle")
public class CorporateStyleController {

    @Autowired
    private CorporateStyleService corporateStyleService;

    @ApiOperation(value = "新增")
    @PostMapping(value = "insert")
    public ResponseVO insert(@RequestBody CorporateStyle record) {
        corporateStyleService.insert(record);
        return ResponseVO.success();
    }

    @ApiOperation(value = "删除")
    @PostMapping(value = "delete")
    public ResponseVO delete(@RequestParam("id") Long id) {
        corporateStyleService.delete(id);
        return ResponseVO.success();
    }

    @ApiOperation(value = "修改")
    @PostMapping(value = "update")
    public ResponseVO update(@RequestBody CorporateStyle record) {
        System.out.println(record);
        corporateStyleService.update(record);
        return ResponseVO.success();
    }

    @ApiOperation(value = "查询列表")
    @PostMapping(value = "list")
    public ResponseVO<List<CorporateStyle>> all(@RequestBody(required = false) CorporateStyle record) {
        List<CorporateStyle> list = corporateStyleService.list(record);
        return ResponseVO.success(list);
    }

}